/////////////////////////
//	File:		Game.h
//	Class:		SGP
//	Updated:	3/8/2012
//	Author:		Roc Myers
/////////////////////////
#pragma once

#include <Windows.h>
#include "GameState.h"
#include "AnimationManager.h"

// SGD Wrappers
#include "SGD Wrappers\CSGD_Direct3D.h"
#include "SGD Wrappers\CSGD_DirectInput.h"
#include "SGD Wrappers\CSGD_TextureManager.h"
#include "SGD Wrappers\CSGD_XAudio2.h"

class Game
{
private:
	struct Settings
	{
		double Sfx;
		double Bgm;
		double Pan;
		int Fullscreen;
	};

	// Currently used file slot
	int ActiveFile;
	int CurMap;

	int drinkID;

	int blankRectBmpID;

	// SGD Wrapper Singletons:
	CSGD_Direct3D*			D3D;
	CSGD_TextureManager*	TM;
	CSGD_DirectInput*		DI;
	CSGD_XAudio2*			XA;
	static Game*			pInstance;

	// Window Properties
	int						Width;
	int						Height;
	bool					Windowed;
	bool					InFocus;

	// Pointers
	GameState*				CurState;
	AnimationManager*		Manager;


	//alt tab fix
	float MusicVol;

	// SINGLETON!
	Game( void );						// constructor
	~Game( void );						// destructor
	Game( const Game& );				// copy-constructor
	Game& operator=( const Game& );		// assignment operator

	// Private functions for main
	bool Input(void);				// handle input - returns false to quit
	void Update(float fElapsedTime);// update game entities
	void Render(void);				// render game entities

	bool LoadSettings(const char* szFileName);

public:
	// Options
	float SfxVol;
	float BgmVol;
	float Pan;
	bool Fullscreen;

	static Game* GetInstance(void);	// SINGLETON accessor

	void DeleteInstance();

	// Inititalize
	void Initialize(HWND hWnd, HINSTANCE hInstance, int nScreenWidth, int nScreenHeight, 
						bool bIsWindowed);

	// Execute
	bool Main( void );

	// Cleanup
	void Shutdown( void );

	// State Change Function
	void ChangeState(GameState* pNewState);

	GameState* GetCurrentState(void) {return CurState;}

	// Game Time
	DWORD Time;

	int GetWinWidth()
	{
		return this->Width;
	}
	
	int GetWinHeight()
	{
		return this->Height;
	}

	void SetMap(int val)	{ CurMap = val; }

	int GetMap(void)	const	{ return CurMap; }
	int GetDrinkID(void)		const	{ return drinkID; }

	int GetActiveFile(void)	const	{ return ActiveFile; }
	void SetActiveFile(int val)	{ ActiveFile = val; }

	void SetGameFocus(bool val)	{ InFocus = val; }
	AnimationManager* GetAnimManager()	const	{ return Manager; }
	int GetBlankRect() { return this->blankRectBmpID;}
};

